using Holoville.HOTween;
using UnityEngine;

public class SkinExporterPreviewController : MonoBehaviour
{
	public UIWidget widget;

	public RotationObject rotator;

	public Transform carPreviewPoint;

	public PlayerInShopManager playerPreview;

	private Product currentWeapon;

	private void Awake()
	{
		HOTween.Init();
	}

	public void ShowPreview()
	{
		playerPreview.ChangeSkin(string.Empty);
		ShowWeaponPreview(null);
		ShowSkinPreview(SkinExporterWindow.instance.productsPanel.selectedProduct);
	}

	public void ShowWeaponPreview(Product product)
	{
		rotator.usedAnimation = false;
		rotator.rotateObject = playerPreview.gameObject;
		playerPreview.gameObject.SetActive(true);
		carPreviewPoint.gameObject.SetActive(false);
		if (currentWeapon != product)
		{
			if (product == null)
			{
				playerPreview.ShowWeapon(null);
				currentWeapon = null;
			}
			else
			{
				playerPreview.ShowWeapon(product.id);
				currentWeapon = product;
			}
		}
	}

	public void ShowSkinPreview(Product product)
	{
		rotator.usedAnimation = false;
		rotator.rotateObject = playerPreview.gameObject;
		playerPreview.gameObject.SetActive(true);
		carPreviewPoint.gameObject.SetActive(false);
		playerPreview.ChangeSkin(product.id);
	}
}
